<?php
#
# author: Phil Spagnolo & Cody Sorgenfrey
# (c)2008 South Hill Calvary Chapel
#

include_once("./root.inc.php");
include("${root}/mysql/database_info.php");
include("${root}/common.php");
include("${root}/mysql/common.php");

function people($result, $num_rows) {
	
	for ($i=0; $i < $num_rows; $i++) {
		printf("<div class='content'>\n");
		printf("<TABLE class='std'>\n");
		$first=mysql_result($result,$i,"first");
		$last=mysql_result($result,$i,"last");
		$loc=mysql_result($result,$i,"location");
		$email=mysql_result($result,$i,"email");
		$picture=mysql_result($result,$i,"picture");
		$par1=mysql_result($result,$i,"bio");
		$search=mysql_result($result,$i,"searchname");
		$blog = mysql_result($result,$i,"blog");
		$name = $first." ".$last;
		printf("\t<tr>\n");
		printf("\t\t<td width='30px'>\n");
		if (!empty($par1)) {
			$id=mysql_result($result,$i,"id");
			printf("\t\t<td width='100px'>\n");
			printf("<a href='missionarybio.php?id=%d'><img src='%s'></a>\n", $id, $picture);
			printf("</td>\n");
		} else {
			printf("\t\t<td width='100px'><img src='%s'></td>\n", $picture);
		}
		printf("\t\t<td width='30px'>&nbsp</td>\n");
		printf("\t\t<td align='left'>\n");
		printf("\t\t\t<TABLE class='std'>\n");
		printf("\t\t\t\t<tr><td><strong>%s</strong></td></tr>\n",$name);
		printf("\t\t\t\t<tr><td>%s</td></tr>\n",$loc);
		printf("\t\t\t\t<tr><td><a href='mailto:%s'>%s</a></td></tr>\n",
		        $email, $email);
		if (!empty($blog)) printf("\t\t\t\t<tr><td><a href='%s'>blog</a></td></tr>\n", $blog);
		if (!empty($par1)) {
			printf("\t\t\t\t<tr><td><br/><a href='missionarybio.php?id=%d'>Read More</a></td></tr>\n",
							$id);
		}
		printf("\t\t\t\t<tr><td><a href='sermon.php?title=&Book=All&service=All&name=" . $search . "&Type=All&date=All'>Sermons from missionary</a></td></tr>\n",$search);
		printf("\t\t\t</table>\n");
		printf("\t\t</td>\n");
		printf("\t<tr><td colspan='3'>&nbsp</td></tr>\n");
		printf("</table>\n");
		printf("</div>\n");
	}
	

}

$table = "missionaries";
connect_select_test($table);

$linkList = array("donations.php");
$textList = array("Donate to support our missionaries");
$title = "Missionaries we support";
$meta_key='missions, outreach, support, pastors, foriegn, countries';
$meta_desc="Meet the missionaries South Hill Calvary Chapel supports, and ministers along side of.";
$query="SELECT * FROM $table ORDER BY last ASC";


print_html_head($title ,$meta_key,$meta_desc);

print_java_head(NULL);;
begin_body();
page_title_no_content($title);

$result=mysql_query($query) or die (mysql_error());
$num_rows=mysql_num_rows($result);
people($result, $num_rows);
mysql_close();

in_page_link(1, false, $linkList, $textList, "");
end_page_title();
end_body();
?>

